<% if !@empty %>
  <% if @item.nil? %>
    <div class="previewError">This item could not be loaded. The window will close shortly or close it <%= link_to('here', 'javascript:void(0);', :onclick => 'togglePreview();') %></div>
    <script type="text/javascript">
      setTimeout("togglePreview()", 5000);
    </script>
  <% else %>
    <div class="previewActions">
      <%= link_to_remote(image_tag('transparent.gif'), :update => 'previewContainer', :url => {:controller => 'search', :action => 'preview_item', :e => 1}, :after => 'togglePreview()', :html => {:class => 'close'}) %>
      <span id="previewbookmark"><%= render :partial => 'resource/items/bookmark', :locals => {:item_id => @item.id, :active => @item.bookmarked, :preview => 1} %></span>
    </div>
    <div class="previewContent">
      <div class="previewTitle">
        <h1>
          <%= (@item.source.nil?) ? @item.title : link_to(@item.title, @item.source_uri, :target => '_blank') %>
          <%= "<span>by #{@item.author}</span>" unless @item.author.nil?  %>
        </h1>
      </div>
      <div class="previewSubTitle">
        <%
        metadata = ''
        metadata += "type: #{@item.type_name} | " unless @item.type_name.nil?
        metadata += "published on: #{@item.published} | " unless @item.published.nil?
        metadata += "size: #{@item.size} | " unless @item.size.nil?
        metadata += "source: #{link_to(@item.source_name, @item.source_uri, :target => '_blank')} | " unless @item.source.nil?
        %>
        <%= metadata %>
      </div>
      <div class="previewBody"><%= @item.abstract %></div>
    </div>
  <% end %>
<% end %>